package com.tree.thrive.business.common.po.properties;

import com.alibaba.fastjson2.JSON;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.List;

/**
 * top-tree
 *
 * @Auther: cheng.tang
 * @Date: 2023/1/4 3:45 PM
 * @Description:
 */
@Component
@Data
@Slf4j
public class ValueProperties {

    @Value("${list.items:1,2,3}")
    private List<String> itemList;
    private String javaVersion;

    @PostConstruct
    public void postConstruct() {
        log.info("itemList {} ", JSON.toJSONString(itemList));
        for (String item : itemList) {
            log.info("item {} ", item);
        }
    }

    @Value("#{systemProperties['java.version'] }")
    public void setJavaVersion(String javaVersion) {
        log.info("setDefaultLocale {} ", javaVersion);
        this.javaVersion = javaVersion;
    }


}
